import 'package:flutter/material.dart';
import 'package:xuance/constant.dart';

class PolicyWidget extends StatelessWidget {
  final bool enable;
  final bool isCheck;
  const PolicyWidget({super.key, required this.enable, required this.isCheck});
  @override
  Widget build(BuildContext context) {
    if (enable) {
      return DefaultTextStyle(
          style: const TextStyle(color: Color(0xff9EA1A6)),
          child: Padding(
              padding: const EdgeInsets.symmetric(horizontal: 20),
              child:
                  Row(crossAxisAlignment: CrossAxisAlignment.start, children: [
                Icon(isCheck ? Icons.check_box : Icons.check_box_outline_blank,
                    color: Color(0xff9EA1A6)),
                const SizedBox(width: 15),
                Expanded(
                    child: Text.rich(TextSpan(children: [
                  const TextSpan(text: "已阅读并同意玄策平台"),
                  TextSpan(
                      text: "《隐私政策》",
                      style: TextStyle(
                          color: c_green, fontWeight: FontWeight.bold)),
                  const TextSpan(text: "和"),
                  TextSpan(
                      text: "《服务条款》",
                      style: TextStyle(
                          color: c_green, fontWeight: FontWeight.bold))
                ])))
              ])));
    } else {
      return DefaultTextStyle(
          style: const TextStyle(color: Color(0xff9EA1A6)),
          child: Padding(
              padding: const EdgeInsets.symmetric(horizontal: 20),
              child: Text.rich(TextSpan(children: [
                TextSpan(
                    text: "《隐私政策》",
                    style:
                        TextStyle(color: c_green, fontWeight: FontWeight.bold)),
                const TextSpan(text: "和"),
                TextSpan(
                    text: "《服务条款》",
                    style:
                        TextStyle(color: c_green, fontWeight: FontWeight.bold))
              ]))));
    }
  }
}
